/* ----------------------------------------------------------------------------------------------------
*
*  Copyright 2002 e Professional Corporation.  All Rights Reserved.
*
*  File		:		CheckboxTag.java
*
*  Author	:		Nink
*
*  Date		:		14/05/2002
*
*---------------------------------------------------------------------------------------------------- */

package com.epro.standard.frontend.tagext;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;


public class CheckboxTag extends TagSupport {

    private String event, label, value, name, size, check;
    /*	
	public void setEvent(String event){
		this.event = event;	
	}
*/
    private String styleClass = "";
    private String styleS = "";

    public void setStyleClass(String styleClass) {
        this.styleClass = styleClass;
    }

    public void setStyleS(String styleS) {
        this.styleS = styleS;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSize(String size) {
        this.size = size;
    }

    public void setCheck(String check) {
        this.check = check;
    }

    public void setOnclick(String event) {
        this.event = event;
    }

    public int doStartTag() throws javax.servlet.jsp.JspException {
        try {
            String str = "";
            JspWriter out = pageContext.getOut();


            if ((label != null) && (label != ""))
                label = " label=\"" + label + "\"";
            else
                label = "";

            if ((value != null) && (value != ""))
                value = " value=\"" + value + "\"";
            else
                value = "";

            if ((name != null) && (name != ""))
                name = " name=\"" + name + "\"";
            else
                name = "";

            if ((size != null) && (size != ""))
                size = " size=\"" + size + "\"";
            else
                size = "";

            if ((check != null) && (check != ""))
                check = " check=\"" + check + "\"";
            else
                check = "";

            if ((event != null) && (event != ""))
                event = " event=\"" + event + "\"";
            else
                event = "";


            if (!(styleClass.equals("")))
                str += " styleClass=\"" + styleClass + "\"";
            if (!(styleS.equals("")))
                str += " styleS=\"" + styleS + "\"";

            out.print("<epro:checkbox" + event + label + value + name + size + 
                      check);
            out.print(" " + str + "/>");
        }

        catch (IOException e) {
            throw new JspException(e.getMessage());
        }

        return SKIP_BODY;

    }
}

